package oop.ex2.tokenizer;

import oop.ex2.expression.CustomBinaryNode;
import oop.ex2.expression.ExpressionNode;
import oop.ex2.expression.FunctionNode;

/**
 * This searches for a custom binary operator. The custom symbol is stored as well as the custom node that
 * should be returned.
 * @author daniel_i_l
 *
 */
public class CustomBinaryAnalyzer extends BinaryOpAnalyzer {	
	
	private FunctionNode _functionNode;
	
	/**
	 * Construct a custom analyzer with the pattern to look for and the function to return.
	 * @param tokenPattern The pattern to look for.
	 * @param functionNode The custom function to return.
	 */
	public CustomBinaryAnalyzer(String tokenPattern, FunctionNode functionNode) {
		super(tokenPattern);
		_functionNode = functionNode;
	}

	@Override
	public ExpressionNode getExpressionNode() {
		return new CustomBinaryNode(_matchedString, _functionNode);
	}

}
